| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

ContextMenu.h
1 // ContextMenu.h
3 //
5
6 namespace nkWinUi
7 {
11 class ContextMenu : public Component
12 {
13 public :
14
15 // Internal item
19 class Item
20 {
21 public :
22
23 // Constructor, destructor
27 Item () noexcept ;
31 virtual ~Item () ;
32
33 // Getters
37 virtual nkMemory::StringView getLabel () const = 0 ;
41 virtual std::function<void ()> getCallback () const = 0 ;
42 } ;
43
44 public :
45
53 ContextMenu (System* system) noexcept ;
57 virtual ~ContextMenu () ;
58
59 // Getters
63 Component* getParentComponent () const ;
64
65 // Getters
74 virtual Item* getItem (unsigned int index) const = 0 ;
78 virtual unsigned int getItemCount () const = 0 ;
79
80 // Setters
87 void setAutomaticSizing (bool value) ;
88
89 // Content creation
98 virtual Item* addItem (nkMemory::StringView label, std::function<void ()> callback) = 0 ;
102 virtual void addSeparator () = 0 ;
106 virtual void clearItems () = 0 ;
107
108 // View
114 virtual void pop () = 0 ;
115
116 // Recomputations
121 virtual void recomputeSizeToFitItems () = 0 ;
122
123 // Import / Export
124 virtual void exportClassToTree (nkExport::Node* rootNode) override ;
125 virtual void importClassFromTree (nkExport::Node* rootNode) override ;
126
127 public :
128
129 // Statics
137 static nkMemory::UniquePtr<ContextMenu> create (System* system = nullptr) ;
138 } ;
139 }
nkExport
Encompasses all API of component NilkinsExport.
Definition: Base64Encoder.h:7
nkWinUi::Component
Base class for any graphical component.
Definition: Component.h:12
nkWinUi::System
The main system of the component.
Definition: System.h:18
nkWinUi
Encompasses all API of component NilkinsWinUi.
Definition: Clipboard.h:7
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7